<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/js/templateme.js"></script>
   
</head>

<body>
    <div id="id"> </div>

    <script type="text/html" id="tpl_user">
        <div>姓名:{{name}}</div>
        <div>年龄:{{age}}</div>
        <div>性别:{{sex}}</div>
        <div>地址:{{address}}</div>
    </script>
    
    <script>
        var data = {
            name: 'pink', age: 20, sex: '女', address: '北京'
        }

        var htmlstr = template('tpl_user',data)

        var dom = document.querySelector('#id')
        dom.innerHTML = htmlstr

    </script>
    
</body>

</html>